import turtle

pen = turtle.Pen()
answer = turtle.textinput("Question", "你想画个三角形吗？[y/n]")
# 注意是2个"等号"
if answer == "y":
    pen.pencolor("darkred")
    for i in range(3):
        pen.left(120)
        pen.forward(100)
else:
    pen.pencolor("darkgreen")
    for i in range(4):
        pen.left(90)
        pen.forward(100)

turtle.done()